//websocket封装
export class WSClient{

    socket:WebSocket = null;
    url:string = null
    constructor(url:string){
        if(!url){
            throw new Error("websocket 的url不能为空！")
        }
        this.url = url;
    }


    start(){
        if(this.socket!=null && this.socket.readyState!=WebSocket.CLOSED){
            console.log("连接不是关闭状态或正在连接中！");
            return
        }
        let socket = new WebSocket(this.url);
    }
}